package b.m;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.view.View;
import android.view.ViewGroup;
import b.m.a;
import b.m.m;

public abstract class j0 extends m {
    private static final String[] L = {"android:visibility:visibility", "android:visibility:parent"};
    private int K = 3;

    class a extends n {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ ViewGroup f1427a;

        /* renamed from: b  reason: collision with root package name */
        final /* synthetic */ View f1428b;

        /* renamed from: c  reason: collision with root package name */
        final /* synthetic */ View f1429c;

        a(ViewGroup viewGroup, View view, View view2) {
            this.f1427a = viewGroup;
            this.f1428b = view;
            this.f1429c = view2;
        }

        public void a(m mVar) {
            x.a(this.f1427a).c(this.f1428b);
        }

        public void b(m mVar) {
            if (this.f1428b.getParent() == null) {
                x.a(this.f1427a).a(this.f1428b);
            } else {
                j0.this.f();
            }
        }

        public void e(m mVar) {
            this.f1429c.setTag(j.save_overlay_view, (Object) null);
            x.a(this.f1427a).c(this.f1428b);
            mVar.P(this);
        }
    }

    private static class b extends AnimatorListenerAdapter implements m.f, a.C0053a {

        /* renamed from: a  reason: collision with root package name */
        private final View f1431a;

        /* renamed from: b  reason: collision with root package name */
        private final int f1432b;

        /* renamed from: c  reason: collision with root package name */
        private final ViewGroup f1433c;

        /* renamed from: d  reason: collision with root package name */
        private final boolean f1434d;
        private boolean e;
        boolean f = false;

        b(View view, int i, boolean z) {
            this.f1431a = view;
            this.f1432b = i;
            this.f1433c = (ViewGroup) view.getParent();
            this.f1434d = z;
            g(true);
        }

        private void f() {
            if (!this.f) {
                c0.h(this.f1431a, this.f1432b);
                ViewGroup viewGroup = this.f1433c;
                if (viewGroup != null) {
                    viewGroup.invalidate();
                }
            }
            g(false);
        }

        private void g(boolean z) {
            ViewGroup viewGroup;
            if (this.f1434d && this.e != z && (viewGroup = this.f1433c) != null) {
                this.e = z;
                x.c(viewGroup, z);
            }
        }

        public void a(m mVar) {
            g(false);
        }

        public void b(m mVar) {
            g(true);
        }

        public void c(m mVar) {
        }

        public void d(m mVar) {
        }

        public void e(m mVar) {
            f();
            mVar.P(this);
        }

        public void onAnimationCancel(Animator animator) {
            this.f = true;
        }

        public void onAnimationEnd(Animator animator) {
            f();
        }

        public void onAnimationPause(Animator animator) {
            if (!this.f) {
                c0.h(this.f1431a, this.f1432b);
            }
        }

        public void onAnimationRepeat(Animator animator) {
        }

        public void onAnimationResume(Animator animator) {
            if (!this.f) {
                c0.h(this.f1431a, 0);
            }
        }

        public void onAnimationStart(Animator animator) {
        }
    }

    private static class c {

        /* renamed from: a  reason: collision with root package name */
        boolean f1435a;

        /* renamed from: b  reason: collision with root package name */
        boolean f1436b;

        /* renamed from: c  reason: collision with root package name */
        int f1437c;

        /* renamed from: d  reason: collision with root package name */
        int f1438d;
        ViewGroup e;
        ViewGroup f;

        c() {
        }
    }

    private void c0(s sVar) {
        sVar.f1466a.put("android:visibility:visibility", Integer.valueOf(sVar.f1467b.getVisibility()));
        sVar.f1466a.put("android:visibility:parent", sVar.f1467b.getParent());
        int[] iArr = new int[2];
        sVar.f1467b.getLocationOnScreen(iArr);
        sVar.f1466a.put("android:visibility:screenLocation", iArr);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:22:0x0079, code lost:
        if (r9 == 0) goto L_0x008c;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:26:0x0083, code lost:
        if (r0.e == null) goto L_0x008c;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:34:0x0095, code lost:
        if (r0.f1437c == 0) goto L_0x0097;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private b.m.j0.c d0(b.m.s r8, b.m.s r9) {
        /*
            r7 = this;
            b.m.j0$c r0 = new b.m.j0$c
            r0.<init>()
            r1 = 0
            r0.f1435a = r1
            r0.f1436b = r1
            java.lang.String r2 = "android:visibility:parent"
            r3 = 0
            r4 = -1
            java.lang.String r5 = "android:visibility:visibility"
            if (r8 == 0) goto L_0x0033
            java.util.Map<java.lang.String, java.lang.Object> r6 = r8.f1466a
            boolean r6 = r6.containsKey(r5)
            if (r6 == 0) goto L_0x0033
            java.util.Map<java.lang.String, java.lang.Object> r6 = r8.f1466a
            java.lang.Object r6 = r6.get(r5)
            java.lang.Integer r6 = (java.lang.Integer) r6
            int r6 = r6.intValue()
            r0.f1437c = r6
            java.util.Map<java.lang.String, java.lang.Object> r6 = r8.f1466a
            java.lang.Object r6 = r6.get(r2)
            android.view.ViewGroup r6 = (android.view.ViewGroup) r6
            r0.e = r6
            goto L_0x0037
        L_0x0033:
            r0.f1437c = r4
            r0.e = r3
        L_0x0037:
            if (r9 == 0) goto L_0x005a
            java.util.Map<java.lang.String, java.lang.Object> r6 = r9.f1466a
            boolean r6 = r6.containsKey(r5)
            if (r6 == 0) goto L_0x005a
            java.util.Map<java.lang.String, java.lang.Object> r3 = r9.f1466a
            java.lang.Object r3 = r3.get(r5)
            java.lang.Integer r3 = (java.lang.Integer) r3
            int r3 = r3.intValue()
            r0.f1438d = r3
            java.util.Map<java.lang.String, java.lang.Object> r3 = r9.f1466a
            java.lang.Object r2 = r3.get(r2)
            android.view.ViewGroup r2 = (android.view.ViewGroup) r2
            r0.f = r2
            goto L_0x005e
        L_0x005a:
            r0.f1438d = r4
            r0.f = r3
        L_0x005e:
            r2 = 1
            if (r8 == 0) goto L_0x0086
            if (r9 == 0) goto L_0x0086
            int r8 = r0.f1437c
            int r9 = r0.f1438d
            if (r8 != r9) goto L_0x0070
            android.view.ViewGroup r8 = r0.e
            android.view.ViewGroup r9 = r0.f
            if (r8 != r9) goto L_0x0070
            return r0
        L_0x0070:
            int r8 = r0.f1437c
            int r9 = r0.f1438d
            if (r8 == r9) goto L_0x007c
            if (r8 != 0) goto L_0x0079
            goto L_0x0097
        L_0x0079:
            if (r9 != 0) goto L_0x009a
            goto L_0x008c
        L_0x007c:
            android.view.ViewGroup r8 = r0.f
            if (r8 != 0) goto L_0x0081
            goto L_0x0097
        L_0x0081:
            android.view.ViewGroup r8 = r0.e
            if (r8 != 0) goto L_0x009a
            goto L_0x008c
        L_0x0086:
            if (r8 != 0) goto L_0x0091
            int r8 = r0.f1438d
            if (r8 != 0) goto L_0x0091
        L_0x008c:
            r0.f1436b = r2
        L_0x008e:
            r0.f1435a = r2
            goto L_0x009a
        L_0x0091:
            if (r9 != 0) goto L_0x009a
            int r8 = r0.f1437c
            if (r8 != 0) goto L_0x009a
        L_0x0097:
            r0.f1436b = r1
            goto L_0x008e
        L_0x009a:
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: b.m.j0.d0(b.m.s, b.m.s):b.m.j0$c");
    }

    public String[] D() {
        return L;
    }

    public boolean F(s sVar, s sVar2) {
        if (sVar == null && sVar2 == null) {
            return false;
        }
        if (sVar != null && sVar2 != null && sVar2.f1466a.containsKey("android:visibility:visibility") != sVar.f1466a.containsKey("android:visibility:visibility")) {
            return false;
        }
        c d0 = d0(sVar, sVar2);
        if (d0.f1435a) {
            return d0.f1437c == 0 || d0.f1438d == 0;
        }
        return false;
    }

    public abstract Animator e0(ViewGroup viewGroup, View view, s sVar, s sVar2);

    public Animator f0(ViewGroup viewGroup, s sVar, int i, s sVar2, int i2) {
        if ((this.K & 1) != 1 || sVar2 == null) {
            return null;
        }
        if (sVar == null) {
            View view = (View) sVar2.f1467b.getParent();
            if (d0(t(view, false), E(view, false)).f1435a) {
                return null;
            }
        }
        return e0(viewGroup, sVar2.f1467b, sVar, sVar2);
    }

    public void g(s sVar) {
        c0(sVar);
    }

    public abstract Animator g0(ViewGroup viewGroup, View view, s sVar, s sVar2);

    /* JADX WARNING: Code restructure failed: missing block: B:37:0x007f, code lost:
        if (r10.w != false) goto L_0x0081;
     */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x0040  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public android.animation.Animator h0(android.view.ViewGroup r11, b.m.s r12, int r13, b.m.s r14, int r15) {
        /*
            r10 = this;
            int r13 = r10.K
            r0 = 2
            r13 = r13 & r0
            r1 = 0
            if (r13 == r0) goto L_0x0008
            return r1
        L_0x0008:
            if (r12 != 0) goto L_0x000b
            return r1
        L_0x000b:
            android.view.View r13 = r12.f1467b
            if (r14 == 0) goto L_0x0012
            android.view.View r2 = r14.f1467b
            goto L_0x0013
        L_0x0012:
            r2 = r1
        L_0x0013:
            int r3 = b.m.j.save_overlay_view
            java.lang.Object r3 = r13.getTag(r3)
            android.view.View r3 = (android.view.View) r3
            r4 = 0
            r5 = 1
            if (r3 == 0) goto L_0x0023
            r2 = r1
            r6 = 1
            goto L_0x0089
        L_0x0023:
            if (r2 == 0) goto L_0x0036
            android.view.ViewParent r3 = r2.getParent()
            if (r3 != 0) goto L_0x002c
            goto L_0x0036
        L_0x002c:
            r3 = 4
            if (r15 != r3) goto L_0x0030
            goto L_0x0032
        L_0x0030:
            if (r13 != r2) goto L_0x003b
        L_0x0032:
            r3 = r2
            r6 = 0
            r2 = r1
            goto L_0x003e
        L_0x0036:
            if (r2 == 0) goto L_0x003b
            r3 = r1
            r6 = 0
            goto L_0x003e
        L_0x003b:
            r2 = r1
            r3 = r2
            r6 = 1
        L_0x003e:
            if (r6 == 0) goto L_0x0085
            android.view.ViewParent r6 = r13.getParent()
            if (r6 != 0) goto L_0x0047
            goto L_0x0081
        L_0x0047:
            android.view.ViewParent r6 = r13.getParent()
            boolean r6 = r6 instanceof android.view.View
            if (r6 == 0) goto L_0x0085
            android.view.ViewParent r6 = r13.getParent()
            android.view.View r6 = (android.view.View) r6
            b.m.s r7 = r10.E(r6, r5)
            b.m.s r8 = r10.t(r6, r5)
            b.m.j0$c r7 = r10.d0(r7, r8)
            boolean r7 = r7.f1435a
            if (r7 != 0) goto L_0x006a
            android.view.View r2 = b.m.r.a(r11, r13, r6)
            goto L_0x0085
        L_0x006a:
            int r7 = r6.getId()
            android.view.ViewParent r6 = r6.getParent()
            if (r6 != 0) goto L_0x0085
            r6 = -1
            if (r7 == r6) goto L_0x0085
            android.view.View r6 = r11.findViewById(r7)
            if (r6 == 0) goto L_0x0085
            boolean r6 = r10.w
            if (r6 == 0) goto L_0x0085
        L_0x0081:
            r2 = r3
            r6 = 0
            r3 = r13
            goto L_0x0089
        L_0x0085:
            r6 = 0
            r9 = r3
            r3 = r2
            r2 = r9
        L_0x0089:
            if (r3 == 0) goto L_0x00db
            if (r6 != 0) goto L_0x00bd
            java.util.Map<java.lang.String, java.lang.Object> r15 = r12.f1466a
            java.lang.String r1 = "android:visibility:screenLocation"
            java.lang.Object r15 = r15.get(r1)
            int[] r15 = (int[]) r15
            r1 = r15[r4]
            r15 = r15[r5]
            int[] r0 = new int[r0]
            r11.getLocationOnScreen(r0)
            r2 = r0[r4]
            int r1 = r1 - r2
            int r2 = r3.getLeft()
            int r1 = r1 - r2
            r3.offsetLeftAndRight(r1)
            r0 = r0[r5]
            int r15 = r15 - r0
            int r0 = r3.getTop()
            int r15 = r15 - r0
            r3.offsetTopAndBottom(r15)
            b.m.w r15 = b.m.x.a(r11)
            r15.a(r3)
        L_0x00bd:
            android.animation.Animator r12 = r10.g0(r11, r3, r12, r14)
            if (r6 != 0) goto L_0x00da
            if (r12 != 0) goto L_0x00cd
            b.m.w r11 = b.m.x.a(r11)
            r11.c(r3)
            goto L_0x00da
        L_0x00cd:
            int r14 = b.m.j.save_overlay_view
            r13.setTag(r14, r3)
            b.m.j0$a r14 = new b.m.j0$a
            r14.<init>(r11, r3, r13)
            r10.a(r14)
        L_0x00da:
            return r12
        L_0x00db:
            if (r2 == 0) goto L_0x00fd
            int r13 = r2.getVisibility()
            b.m.c0.h(r2, r4)
            android.animation.Animator r11 = r10.g0(r11, r2, r12, r14)
            if (r11 == 0) goto L_0x00f9
            b.m.j0$b r12 = new b.m.j0$b
            r12.<init>(r2, r15, r5)
            r11.addListener(r12)
            b.m.a.a(r11, r12)
            r10.a(r12)
            goto L_0x00fc
        L_0x00f9:
            b.m.c0.h(r2, r13)
        L_0x00fc:
            return r11
        L_0x00fd:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: b.m.j0.h0(android.view.ViewGroup, b.m.s, int, b.m.s, int):android.animation.Animator");
    }

    public void i0(int i) {
        if ((i & -4) == 0) {
            this.K = i;
            return;
        }
        throw new IllegalArgumentException("Only MODE_IN and MODE_OUT flags are allowed");
    }

    public void j(s sVar) {
        c0(sVar);
    }

    public Animator n(ViewGroup viewGroup, s sVar, s sVar2) {
        c d0 = d0(sVar, sVar2);
        if (!d0.f1435a) {
            return null;
        }
        if (d0.e == null && d0.f == null) {
            return null;
        }
        if (d0.f1436b) {
            return f0(viewGroup, sVar, d0.f1437c, sVar2, d0.f1438d);
        }
        return h0(viewGroup, sVar, d0.f1437c, sVar2, d0.f1438d);
    }
}
